all: addons.xml addons.php

addons_installed:
	@ls -1 addons

# Why doesn't the dependency work as a dependency?
addons.xml: pressless/addons.mk
	@echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
	@echo >> $@
	@echo '<addons xmlns="http://www.pressless-is-priceless.org/addon" xmlns:xi="http://www.w3.org/2001/XInclude">' >> $@
	@for a in `ls addons`; do echo "  <xi:include href=\"addons/$$a/addon.xml\" />"; done >> $@
	@echo '</addons>' >> $@

addons.php: pressless/addons.mk
	@echo '<?php' > $@
	@echo >> $@
	@for a in `ls addons`; do echo "\$$pressless_addons[] = '$$a';"; done >> $@
	@echo >> $@
	@echo '?>' >> $@

.PHONY: install_addon
